<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>鼠标悬浮文字底部下划线变宽</title>
    <style>
        body {
            font-family: 'Arial', sans-serif;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100vh;
            margin: 0;
            background-color: #f0f0f0;
        }

        .container {
            text-align: center;
            padding: 20px;
            background-color: white;
            border-radius: 8px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            max-width: 500px;
            width: 100%;
        }

        .demo-text {
            font-size: 32px;
            font-weight: bold;
            margin: 30px 0;
            color: #333;
            cursor: pointer;
            position: relative;
            display: inline-block;
        }

        .demo-text::after {
            content: '';
            position: absolute;
            bottom: -5px;
            left: 0;
            width: 0;
            height: 3px;
            background-color: #2196F3;
            transition: width 0.3s ease;
        }

        .demo-text:hover::after {
            width: 100%;
        }

        .code-section {
            margin-top: 30px;
            text-align: left;
        }

        pre {
            background-color: #f5f5f5;
            padding: 15px;
            border-radius: 4px;
            overflow-x: auto;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>鼠标悬浮文字底部下划线变宽</h1>
        <div class="demo-text">鼠标悬浮我试试</div>
        <div class="code-section">
            <h3>CSS代码:</h3>
            <pre><code>.demo-text {
    font-size: 32px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    position: relative;
    display: inline-block;
}

.demo-text::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 3px;
    background-color: #2196F3;
    transition: width 0.3s ease;
}

.demo-text:hover::after {
    width: 100%;
}</code></pre>
        </div>
    </div>
</body>
</html>